{"ast":null,"code":"var _jsxFileName = \"/data/messenger.client/src/components/Avatar/index.tsx\",\n  _s = $RefreshSig$();\nimport React from \"react\";\nimport { generateAvatarByNickname } from \"../../utils/helpers\";\nimport { Carousel } from \"../index\";\nimport InputFiles from 'react-input-files';\nimport classNames from \"classnames\";\nimport './Avatar.scss';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\nconst Avatar = _ref => {\n  _s();\n  let {\n    contentList,\n    alt,\n    stringForGenerateColor,\n    stringForFirstCharacter,\n    shortAvatar = true,\n    selfProfile = false\n  } = _ref;\n  const [collection, setCollection] = React.useState();\n  const [lengthContent, setLengthContent] = React.useState(0);\n  const {\n    colors\n  } = generateAvatarByNickname(stringForGenerateColor);\n  const firstChar = stringForFirstCharacter[0].toUpperCase();\n  React.useEffect(() => {\n    if (!shortAvatar && contentList !== null && contentList !== void 0 && contentList.items.length) {\n      setLengthContent(contentList.items.length);\n      setCollection(contentList.items.map((item, index) => {\n        return /*#__PURE__*/_jsxDEV(\"img\", {\n          className: \"avatar\",\n          src: item.link,\n          alt: 'Avatar ' + alt\n        }, index, false, {\n          fileName: _jsxFileName,\n          lineNumber: 29,\n          columnNumber: 25\n        }, this);\n      }));\n    }\n  }, [contentList]);\n  if (shortAvatar) {\n    if (contentList && contentList.items && contentList.items.length > 0) {\n      return /*#__PURE__*/_jsxDEV(\"img\", {\n        className: \"avatar\",\n        src: contentList.items[0].link,\n        alt: 'Avatar ' + alt\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 39,\n        columnNumber: 17\n      }, this);\n    } else {\n      return /*#__PURE__*/_jsxDEV(\"div\", {\n        style: {\n          background: `linear-gradient(135deg, ${colors.color} 0%, ${colors.colorLighten} 96.52%)`\n        },\n        className: \"avatar avatar--symbol\",\n        children: firstChar\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 43,\n        columnNumber: 17\n      }, this);\n    }\n  } else {\n    if (selfProfile) {\n      if (contentList && collection) {\n        return /*#__PURE__*/_jsxDEV(Carousel, {\n          width: 200,\n          children: [collection, lengthContent < 6 && /*#__PURE__*/_jsxDEV(InputFiles, {\n            accept: \"image/*\",\n            children: /*#__PURE__*/_jsxDEV(\"div\", {\n              className: classNames('avatar', 'uploadAvatar')\n            }, void 0, false, {\n              fileName: _jsxFileName,\n              lineNumber: 59,\n              columnNumber: 33\n            }, this)\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 58,\n            columnNumber: 29\n          }, this)]\n        }, void 0, true, {\n          fileName: _jsxFileName,\n          lineNumber: 55,\n          columnNumber: 21\n        }, this);\n      } else {\n        return /*#__PURE__*/_jsxDEV(Carousel, {\n          width: 200,\n          customBackground: `linear-gradient(135deg, ${colors.color} 0%, ${colors.colorLighten} 96.52%)`,\n          children: [/*#__PURE__*/_jsxDEV(\"div\", {\n            className: \"avatar avatar--symbol\",\n            children: firstChar\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 69,\n            columnNumber: 25\n          }, this), /*#__PURE__*/_jsxDEV(InputFiles, {\n            accept: \"image/*\",\n            children: /*#__PURE__*/_jsxDEV(\"div\", {\n              className: classNames('avatar', 'uploadAvatar')\n            }, void 0, false, {\n              fileName: _jsxFileName,\n              lineNumber: 73,\n              columnNumber: 29\n            }, this)\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 72,\n            columnNumber: 25\n          }, this)]\n        }, void 0, true, {\n          fileName: _jsxFileName,\n          lineNumber: 66,\n          columnNumber: 21\n        }, this);\n      }\n    } else {\n      if (contentList && collection) {\n        if (contentList.items.length === 1) {\n          return /*#__PURE__*/_jsxDEV(\"img\", {\n            className: \"avatar\",\n            src: contentList.items[0].link,\n            alt: 'Avatar ' + alt\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 82,\n            columnNumber: 25\n          }, this);\n        } else {\n          return /*#__PURE__*/_jsxDEV(Carousel, {\n            width: 200,\n            children: collection\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 86,\n            columnNumber: 25\n          }, this);\n        }\n      } else {\n        return /*#__PURE__*/_jsxDEV(\"div\", {\n          style: {\n            background: `linear-gradient(135deg, ${colors.color} 0%, ${colors.colorLighten} 96.52%)`\n          },\n          className: \"avatar avatar--symbol\",\n          children: firstChar\n        }, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 93,\n          columnNumber: 21\n        }, this);\n      }\n    }\n  }\n};\n_s(Avatar, \"1OmvaPSwM71eXYIM0Pp2GuMzfbA=\");\n_c = Avatar;\nexport default Avatar;\nvar _c;\n$RefreshReg$(_c, \"Avatar\");","map":{"version":3,"names":["React","generateAvatarByNickname","Carousel","InputFiles","classNames","Avatar","contentList","alt","stringForGenerateColor","stringForFirstCharacter","shortAvatar","selfProfile","collection","setCollection","useState","lengthContent","setLengthContent","colors","firstChar","toUpperCase","useEffect","items","length","map","item","index","link","background","color","colorLighten"],"sources":["/data/messenger.client/src/components/Avatar/index.tsx"],"sourcesContent":["import React from \"react\";\nimport {AvatarProps} from \"../../models/props/AvatarProps\";\nimport { generateAvatarByNickname } from \"../../utils/helpers\";\nimport {Carousel} from \"../index\";\nimport InputFiles from 'react-input-files';\nimport classNames from \"classnames\";\nimport './Avatar.scss';\n\nconst Avatar: React.FC<AvatarProps> = ({\n       contentList,\n       alt,\n       stringForGenerateColor,\n       stringForFirstCharacter,\n       shortAvatar = true,\n       selfProfile = false\n}) => {\n    const [collection, setCollection] = React.useState<React.ReactNode |React.ReactNode[]>();\n    const [lengthContent, setLengthContent] = React.useState<number>(0);\n\n    const {colors} = generateAvatarByNickname(stringForGenerateColor);\n    const firstChar = stringForFirstCharacter[0].toUpperCase();\n\n    React.useEffect(() => {\n        if (!shortAvatar && contentList?.items.length!) {\n            setLengthContent(contentList.items.length);\n            setCollection(\n                contentList.items.map((item, index) => {\n                    return (\n                        <img key={index} className='avatar' src={item.link} alt={'Avatar ' + alt}/>\n                    );\n                })\n            );\n        }\n    }, [contentList]);\n\n    if (shortAvatar) {\n        if (contentList && contentList.items && contentList.items.length > 0) {\n            return (\n                <img className='avatar' src={contentList.items[0].link} alt={'Avatar ' + alt}/>\n            );\n        } else {\n            return (\n                <div\n                    style={{background: `linear-gradient(135deg, ${colors.color} 0%, ${colors.colorLighten} 96.52%)`}}\n                    className='avatar avatar--symbol'\n                >\n                    {firstChar}\n                </div>\n            );\n        }\n    } else {\n        if (selfProfile) {\n            if (contentList && collection!) {\n                return (\n                    <Carousel width={200} >\n                        {collection}\n                        {lengthContent < 6 &&\n                            <InputFiles accept=\"image/*\" >\n                                <div className={classNames('avatar', 'uploadAvatar')}/>\n                            </InputFiles>\n                        }\n                    </Carousel>\n                );\n            } else {\n                return (\n                    <Carousel width={200}\n                              customBackground={`linear-gradient(135deg, ${colors.color} 0%, ${colors.colorLighten} 96.52%)`}\n                    >\n                        <div className='avatar avatar--symbol'>\n                            {firstChar}\n                        </div>\n                        <InputFiles accept=\"image/*\" >\n                            <div className={classNames('avatar', 'uploadAvatar')}/>\n                        </InputFiles>\n                    </Carousel>\n                );\n            }\n        } else {\n            if (contentList && collection!) {\n                if (contentList.items.length === 1) {\n                    return (\n                        <img className='avatar' src={contentList.items[0].link} alt={'Avatar ' + alt}/>\n                    );\n                } else {\n                    return (\n                        <Carousel width={200} >\n                            {collection}\n                        </Carousel>\n                    );\n                }\n            } else {\n                return (\n                    <div\n                        style={{background: `linear-gradient(135deg, ${colors.color} 0%, ${colors.colorLighten} 96.52%)`}}\n                        className='avatar avatar--symbol'>\n                        {firstChar}\n                    </div>\n                );\n            }\n        }\n    }\n}\n\nexport default Avatar;\n"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,wBAAwB,QAAQ,qBAAqB;AAC9D,SAAQC,QAAQ,QAAO,UAAU;AACjC,OAAOC,UAAU,MAAM,mBAAmB;AAC1C,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAO,eAAe;AAAC;AAEvB,MAAMC,MAA6B,GAAG,QAOhC;EA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